package com.jkhan.demo.inheritance.proxy;

/**
 * @ClassName NetWorkTest
 * @Description proxy design model
 * @Author F117
 * @Date 2021/12/30 15:56
 **/
public class NetWorkTest {
    public static void main(String[] args) {
        Server server = new Server();
        ProxyServer proxyServer = new ProxyServer(server);
        proxyServer.browse();
    }
}

interface NetWork {
    public void browse();
}

class Server implements NetWork {

    @Override
    public void browse() {
        System.out.println("real browse server");
    }
}

class ProxyServer implements NetWork {
    private NetWork netWork;

    public ProxyServer(NetWork netWork) {
        this.netWork = netWork;
    }

    public void check() {
        System.out.println("check browse...");
    }

    @Override
    public void browse() {
        check();
        netWork.browse();
    }
}
